#include<bits/stdc++.h>
#define int long long 
using namespace std;
char buf[1 << 23], *p1 = buf, *p2 = buf;
#define getc() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 21, stdin), p1 == p2) ? EOF : *p1++)
inline int read() {
	int x = 0, f = 0; char ch = getc();
	while(ch < '0' or ch > '9') f |= (ch == '-'), ch = getc();
	while(ch >= '0' and ch <= '9') x = (x << 1) + (x << 3) + (ch ^ 48), ch = getc();
	return f ? -x : x;
}
int __stk[128], __top;
inline void write(int x) {
    if(x < 0) putchar('-'), x = -x;
	do { __stk[++__top] = x % 10, x /= 10; } while(x);
	while (__top) putchar(__stk[__top--] + '0');
}
bool stmer;
const int N = 1e6 + 10;
int n, cnt;
int fa[N], ans[N];
bool vis[N];
vector<int> e[N];
void dfs(int x) {
    for(int v : e[x]) if(v ^ fa[x])
        fa[v] = x, dfs(v);
}
void add(int x) {
    int l = cnt + 1;
    while(x and !vis[x]) ans[++cnt] = x, vis[x] = 1, x = fa[x];
    reverse(ans + l, ans + cnt + 1);
}
bool edmer;
signed main() {
	freopen("choice.in", "r", stdin);
	freopen("choice.out", "w", stdout);
	cerr << "[Memory] " << (&stmer - &edmer) / 1024 / 1024 << " MB\n";
	n = read();
    for(int i = 1; i < n; i++) {
        int u = read(), v = read();
        e[u].push_back(v), e[v].push_back(u);
    }
    dfs(1);
    for(int i = 1; i <= n; i++) add(i);
    for(int i = 1; i <= n; i++) write(ans[i]), putchar(' ');
    cerr << "[Runtime] " << (double) clock() / CLOCKS_PER_SEC << " seconds";
	return 0;
} 